package com.hch.maker.template.enums;

import cn.hutool.core.util.StrUtil;

/**
 * @author hch
 * @version 1.0
 * @description 匹配规则枚举类
 * @date 2024/7/27 20:32
 */

public enum FileFilterRuleEnum {
    CONTAINS("包含","contains"),
    STATIC_WITH("前缀匹配","static_with"),
    ENOS_WITH("后缀匹配","enos_with"),

    REGEX("正则","regex"),
    EQUALS("相等","equals");

    private String text;



    private String value;

    FileFilterRuleEnum(String text, String value) {
        this.text = text;
        this.value = value;
    }

    public String getText(){
        return this.text;
    }
    public String getValue(){
        return this.value;
    }

    public static FileFilterRuleEnum getEnumByValue(String value){
        if(StrUtil.isBlank(value)){
            return null;
        }
        for (FileFilterRuleEnum fileFilterRuleEnum : FileFilterRuleEnum.values()) {
            if(value.equals(fileFilterRuleEnum.getValue())){
                return fileFilterRuleEnum;
            }
        }
        return null;
    }
}
